Recording
Waveform Audio
If the MCI
waveform-audio recording services do not meet the specifications of your
application, you can handle waveform-audio recording using the waveform-audio
services. For more information, see MCI
Waveform-Audio Input Data Types
The following
data types are defined for waveform-audio input functions:
Type |
Description |
HWAVEIN |
Handle of
an open waveform-audio input device. |
WAVEFORMATEX |
Structure
that specifies the data formats supported by a particular waveform-audio
input device. This structure is also used for waveform-audio output devices. |
WAVEHDR |
Structure
used as a header for a block of waveform-audio input data. This structure is
also used for waveform-audio output devices. |
WAVEINCAPS |
Structure
used to inquire about the capabilities of a particular waveform-audio input
device. |
Querying Waveform-Audio Input Devices
Before
recording waveform audio, you should call the waveInGetDevCaps
Opening Waveform-Audio Input Devices
Use the waveInOpen
Some
multimedia computers have multiple waveform-audio input devices. Unless you
know you want to open a specific waveform-audio input device in a system, you
should use the WAVE_MAPPER constant for the device identifier when you open a
device. The waveInOpen function will choose the device in the system
best able to record in the specified data format.
Managing Waveform-Audio Recording
After you
open a waveform-audio input device, you can begin recording waveform-audio
data. Waveform-audio data is recorded into application-supplied buffers
specified by a WAVEHDR
Windows
provides the following functions to manage waveform-audio recording.
Function |
Description |
waveInAddBuffer |
Sends a
buffer to the device driver so it can be filled with recorded waveform-audio
data. |
waveInReset |
Stops
waveform-audio recording and marks all pending buffers as done. |
waveInStart |
Starts
waveform-audio recording. |
waveInStop |
Stops
waveform-audio recording. |
Use the waveInAddBuffer
Before you
begin recording by using waveInStart
Before
closing the device using waveInClose
Using Window Messages to Manage Waveform-Audio Recording
The following
messages can be sent to a window procedure function for managing waveform-audio
recording.
Message |
Description |
MM_WIM_CLOSE |
Sent when
the device is closed by using the waveInClose |
MM_WIM_DATA |
Sent when
the device driver is finished with a buffer sent by using the waveInAddBuffer |
MM_WIM_OPEN |
Sent when
the device is opened by using the waveInOpenDZFQLF function. |
The lParam
parameter of MM_WIM_DATA
The most
useful message is probably MM_WIM_DATA. When your application finishes using
the data block sent by the device driver, you can clean up and free the data
block. Unless you need to allocate memory or initialize variables, you probably
do not need to use the MM_WIM_OPEN
The callback
function for waveform-audio input devices is supplied by the application. For
information about this callback function, see the waveInProc